package 常用api;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import static java.lang.System.currentTimeMillis;

public class 日期和时间 {
    public static void main(String[] args) throws ParseException {
        Date date=new Date();
        System.out.println(date);
        System.out.println(date.getTime());
        System.out.println(new Date(date.getTime()));
        Long time= date.getTime();
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss EEE a");
        System.out.println(sdf.format(currentTimeMillis()));
        System.out.println(sdf.format(date));
        Date date1=new Date(sdf.parse("2021-11-11 11:11:11 周三 下午").getTime());
        System.out.println(date1);
    }
}
